package com.zhouyu;

import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextStartedEvent;
import org.springframework.context.event.EventListener;

/**
 * @author caodan
 * @version 1.0
 * @date 2023-06-13 8:47
 */
//@Component
public class ContextRefreshedEventLisner implements ApplicationListener<ContextStartedEvent> {

	// 事件发布器  SimpleApplicationEventMulticaster
	//            EventListenerMethodProcessor   注解版监听器使用

	//            DefaultEventListenerFactory
	// ApplicationListenerDetector   bean的后置处理器 --> 类是否实现Applicationlistener
	@EventListener(ContextStartedEvent.class)
	public void lisner(ContextStartedEvent event) {
		System.out.println("容器刷新事件到达" + event);
	}

	@Override
	public void onApplicationEvent(ContextStartedEvent event) {
		System.out.println("容器刷新事件到达" + event);
	}
}
